﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Text;
namespace Web.Views.AgentManager
{
    public partial class IncomingOrders : System.Web.UI.Page
    {
        public int AgentID = 0;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                AgentID = Easydp.Controllers.AgentController.AgentInfo.AgentID;
            }
        }

      
       
        protected void Button3_Click(object sender, EventArgs e)
        {
            GridView1.DataBind();
           
        }

        public string S(int state)
        {
            switch (state)
            {
                case 1:
                    return "新订单";

                case 2:
                    return "已支付等待出票";

                case 3:
                    return "出票完成";

                case 4:
                    return "退票";

                default:
                    return "";

            }
            //return "";
    
        }



        protected void btnUpload_Click(object sender, EventArgs e)
        {
            string str = ((Button)sender).CommandArgument;
            int OrderID = int.Parse(((Button)sender).CommandName.ToString());
            int State = 0;
            if ("chu" == str)
            {
                State = 3;
            }
            else
            {
                State = 4;
            }
            Easydp.Controllers.OrderController bll = new Easydp.Controllers.OrderController();
            string length=bll.UpdateOrders(OrderID,State);
            if (length.Length < 2)
            {
                Response.Write("<script>alert('操作成功!');window.location.href='" + Request.RawUrl.ToString() + "'</script>");
            }
            else
            { Response.Write("<script>alert('操作失败!');window.location.href='" + Request.RawUrl.ToString() + "'</script>"); }
        }
       
    }
}
